home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / ply15dat.zip / SPOT1.PI < prev    next >
Text File  |  1992-09-19  |  2KB  |  73 lines

  1. viewpoint {
  2.    from <0, 5, -40>
  3.    at <0,0,0>
  4.    up <0,1,0>
  5.    angle 45
  6.    resolution 256, 256
  7.    }
  8.  
  9. background <0, 0.2, 0.3>
  10.  
  11. include "..\colors.inc"
  12.  
  13. // Make a spotlight with a visible outer surface
  14. define throw_length 20
  15. define throw_radius 10
  16. define throw_offset <0, 15, 0>
  17. define throw_orientation <0, 0, -90>
  18.  
  19. // Now from the definitions of the throw lamp, calculate
  20. // the data needed to build the object
  21. define spot_point  <throw_length, 0, 0>
  22. define throw_dist |P|
  23. define throw_angle atan(throw_radius / throw_length)
  24.  
  25. // Fudge for now - the rotation function is not yet defined.
  26. // define throw_point  rotate(spot_point, throw_orientation) + throw_offset
  27. define throw_point <0, -5, 0>
  28.  
  29. // Build the texture for a spotlight with a fading exterior - the exterior
  30. // shading is sensitive to visibility of the light source as well.
  31. define fading_white
  32. texture {
  33.    special surface {
  34.       color white
  35.       ambient (visible(W, throw_offset) == 0
  36.                ? 0
  37.                : (P[0] < 1 ? 1
  38.                  : (P[0] > throw_length ? 0
  39.                     : (throw_length - P[0]) / throw_length)))
  40.       transmission (visible(W, throw_offset) == 1
  41.                     ? (P[0] < 1 ? 0
  42.                        : (P[0] > throw_length ? 1
  43.                           : P[0] / throw_length))
  44.                     : 1), 1
  45.       }
  46.    }
  47. // The next two things are coupled together - the light source
  48. // and the cone around it to make a visible border.
  49. spot_light white, throw_offset, throw_point, 3,
  50.            degrees(throw_angle), degrees(throw_angle)
  51. object {
  52.    cone <0, 0, 0>, 0.1, spot_point, throw_radius
  53.    fading_white
  54.    rotate throw_orientation
  55.    translate throw_offset
  56.    }
  57.  
  58. // Add a couple of other things to complete the scene
  59. object {
  60.    box <-7, 1, -5>, <7, 2, 5>
  61.    rotate <0, 70, 0>
  62.    shiny_red
  63.    }
  64. object {
  65.    sphere <0, 5, 0>, 2
  66.    reflective_gold
  67.    }
  68. object {
  69.    polygon 4, <-20, -5.05, -20>, <-20, -5.05, 40>,
  70.           < 20, -5.05,  40>, < 20, -5.05,-20>
  71.    texture { checker matte_white, matte_black scale <3, 1, 3> }
  72.    }
  73.